<?php
require_once('../scripts/Include/conexion.php');
//include('principal.php');
session_start();
$Base=new Base_Datos();
$Base->tipo_conexion='n';
	if ($Base->conexion()){
		if ($Base->seleccionar_bd()) {
		} else {
			echo "No se pudo seleccionar la base de datos";
			exit;
		} 

	}else {
		echo "No se pudo establecer la conexion";
	}

if (!(isset($_SESSION['IdUsuario']))) {
	header('Location:login.php');
}

if ( $_SESSION['Rol'] != 1) {
	UNSET($_SESSION['IdUsuario']);
	UNSET($_SESSION['Nickname']);
	UNSET($_SESSION['Rol']);
	header('Location:login.php');
}

	$timeregister=date('Y-M-d h:i:s');
	$sql='UPDATE usuarios SET ultimo_ingreso=NOW() WHERE id="'.$_SESSION['IdUsuario'].'"';
	if ($Base->consulta($sql)){
	}else{
		echo "Error al Actualizar ingreso de usuario.";
	}
?>
<html lang="en">
<head>
	<meta charset="utf-8">
	<title>&nbsp;</title>
	<script src="../scripts/jquery-1.7.1.js"></script>
	<script src="../scripts/jquery_1.4.js"></script>
	<script src="../scripts/jquery_validate.js"></script>
	<script src="../scripts/ui/jquery.ui.core.js"></script>
	<script src="../scripts/ui/jquery.ui.widget.js"></script>
	<script src="../scripts/ui/jquery.ui.button.js"></script>
	<script src="../scripts/ui/jquery.ui.tabs.js"></script>
	<script src="../scripts/ui/jquery.ui.datepicker.js"></script>
	<link rel="stylesheet" href="../css/demos.css">
	<link rel="stylesheet" href="../css/themes/cupertino/jquery.ui.all.css">
	<link rel="stylesheet" type="text/css" href="Include/template.css"/>
	<script>
	$(function() {
		$( "#tabs-MAINUSERS" ).tabs({
	<?php 
	echo ( !(isset($_GET['opc'])) )?'selected: 0':'selected: '.($_GET['opc']-1);
	?>	
		});
		
		$( "#btnAdd, #btnMod, #btnElim, #btnCancel" ).button();
		
	});
	</script>
</head>
<body>

<div id="tabs-MAINUSERS">
	<ul>
		<li><a href="#tabs-1" onclick="javascript:window.location.href='main.php'">Inicio</a></li>
		<li><a href="#tabs-2" onclick="javascript:window.location.href='main.php?opc=2'">Usuarios</a></li>
		
	</ul>
	<div id="tabs-1">
	<?php
		include('inicioAdmin.php');
	?>
	</div>
	<div id="tabs-2">
	<?php
	if ( isset($_GET['opc']) ){
		include('usuarios.php');
	}
	?>
	</div>
	
</div>




